<template>
	<view class="leftIcon" @click="iconClick">
		<up-icon name="arrow-left" color="#fff" size="40rpx"></up-icon>
	</view>
</template>

<script setup>
	import {
		toRef
	} from "vue";
	const props = defineProps({
		defaultHandler: {
			type: Boolean,
			default: true
		}
	})
	const defaultHandler = toRef(props, 'defaultHandler')
	const emit = defineEmits(['iconClick'])

	const defaultHanlderActive = () => {
		uni.navigateBack({
			delta: -1
		})
	}

	const iconClick = () => {
		if (defaultHandler.value) defaultHanlderActive()
		else emit('iconClick')
	}
</script>

<style lang="scss">
	.leftIcon {
		width: 64rpx;
		height: 64rpx;
		display: flex;
		justify-content: flex-start;
		align-items: center;
	}
</style>